<div class="content-section introduction">
    <div class="feature-intro">
        <h1>Tooltip</h1>
        <p>Tooltip directive provides advisory information for a component.</p>
    </div>
    <app-demoActions github="tooltip" stackblitz="tooltip-demo"></app-demoActions>
</div>

<div class="content-section implementation">
    <div class="card">
        <h5>Positions</h5>
        <div class="grid p-fluid">
            <div class="col-12 md:col-3">
                <input type="text" pInputText pTooltip="Enter your username" placeholder="Right">
            </div>
            <div class="col-12 md:col-3">
                <input type="text" pInputText pTooltip="Enter your username" tooltipPosition="top" placeholder="Top">
            </div>
            <div class="col-12 md:col-3">
                <input type="text" pInputText pTooltip="Enter your username" tooltipPosition="bottom" placeholder="Bottom">
            </div>
            <div class="col-12 md:col-3">
                <input type="text" pInputText pTooltip="Enter your username" tooltipPosition="left" placeholder="Left">
            </div>
        </div>

        <h5>Focus and Blur</h5>
        <input type="text" pInputText pTooltip="Enter your username" placeholder="Right" tooltipEvent="focus">

        <h5>Button</h5>
        <button pButton pRipple type="button" label="Save" icon="pi pi-check" pTooltip="Click to proceed"></button>
    </div>
</div>

<div class="content-section documentation">
    <p-tabView>
        <p-tabPanel header="Documentation">
                    <h5>Import</h5>
<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
import &#123;TooltipModule&#125; from 'primeng/tooltip';
</app-code>

            <h5>Getting Started</h5>
            <p>Tooltip is applied to an element with pTooltip directive where the value of the directive defines the text to display.</p>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;input type="text" pTooltip="Enter your username"&gt;
</app-code>

            <h5>Position</h5>
            <p>There are four choices to position the tooltip, default value is "right" and alternatives are "top", "bottom", "left". Position is
            specified using <i>tooltipPosition</i> attribute.</p>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;input type="text" pTooltip="Enter your username" tooltipPosition="top"&gt;
</app-code>

            <h5>Events</h5>
            <p>Tooltip gets displayed on hover event of its target by default, other option is the focus event to display and blur to hide.</p>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;input type="text" pTooltip="Enter your username" tooltipPosition="top" tooltipEvent="focus"&gt;
</app-code>

            <h5>Delay</h5>
            <p>Tooltip is displayed or hidden instantly by default however you may add delays using <i>showDelay</i> and <i>hideDelay</i> properties which accept a number value in terms of milliseconds.</p>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;input type="text" pTooltip="Enter your username" tooltipPosition="top" tooltipEvent="focus" showDelay="1000" hideDelay="500"&gt;
</app-code>

            <h5>Scrolling Containers</h5>
            <p>When placed inside a scrolling container like an overflown div, tooltip must be appended to another element that has
                relative positioning instead of document body which is the default.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;div #container style="display:inline-block;position:relative"&gt;
    &lt;input type="text" pInputText pTooltip="Enter your username" placeholder="Right" [appendTo]="container"&gt;
&lt;/div&gt;
</app-code>

            <h5>Properties</h5>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Type</th>
                            <th>Default</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>pTooltip</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Text of the tooltip.</td>
                        </tr>
                        <tr>
                            <td>tooltipPosition</td>
                            <td>string</td>
                            <td>right</td>
                            <td>Position of the tooltip, valid values are right, left, top and bottom.</td>
                        </tr>
                        <tr>
                            <td>fitContent</td>
                            <td>boolean</td>
                            <td>true</td>
                            <td>Automatically adjusts the element position when there is not enough space on the selected position.</td>
                        </tr>
                        <tr>
                            <td>tooltipEvent</td>
                            <td>string</td>
                            <td>hover</td>
                            <td>Event to show the tooltip, valid values are hover and focus.</td>
                        </tr>
                        <tr>
                            <td>positionStyle</td>
                            <td>string</td>
                            <td>absolute</td>
                            <td>Type of CSS position.</td>
                        </tr>
                        <tr>
                            <td>tooltipDisabled</td>
                            <td>boolean</td>
                            <td>false</td>
                            <td>When present, it specifies that the component should be disabled.</td>
                        </tr>
                        <tr>
                            <td>appendTo</td>
                            <td>string</td>
                            <td>any</td>
                            <td>Target element to attach the overlay, valid values are "body", "target" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).</td>
                        </tr>
                        <tr>
                            <td>hideDelay</td>
                            <td>number</td>
                            <td>null</td>
                            <td>Delay to hide the tooltip in milliseconds.</td>
                        </tr>
                        <tr>
                            <td>showDelay</td>
                            <td>number</td>
                            <td>null</td>
                            <td>Delay to show the tooltip in milliseconds.</td>
                        </tr>
                        <tr>
                            <td>life</td>
                            <td>number</td>
                            <td>null</td>
                            <td>Time to wait in milliseconds to hide the tooltip even it is active.</td>
                        </tr>
                        <tr>
                            <td>tooltipStyleClass</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Style class of the tooltip.</td>
                        </tr>
                        <tr>
                            <td>escape</td>
                            <td>boolean</td>
                            <td>true</td>
                            <td>By default the tooltip contents are rendered as text. Set to false to support html tags in the content.</td>
                        </tr>
                        <tr>
                            <td>tooltipZIndex</td>
                            <td>string</td>
                            <td>auto</td>
                            <td>Whether the z-index should be managed automatically to always go on top or have a fixed value.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h5>Styling</h5>
            <p>Following is the list of structural style classes, for theming classes visit <a href="#" [routerLink]="['/theming']">theming page</a>.</p>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Element</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>p-tooltip</td>
                            <td>Container element.</td>
                        </tr>
                        <tr>
                            <td>p-tooltip-arrow</td>
                            <td>Arrow of the tooltip.</td>
                        </tr>
                        <tr>
                            <td>p-tooltip-text</td>
                            <td>Text of the tooltip.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h5>Dependencies</h5>
            <p>None.</p>
        </p-tabPanel>

        <p-tabPanel header="Source">
            <a href="https://github.com/primefaces/primeng/tree/master/src/app/showcase/components/tooltip" class="btn-viewsource" target="_blank">
                <span>View on GitHub</span>
            </a>
            <a href="https://stackblitz.com/edit/primeng-tooltip-demo" class="btn-viewsource" style="margin-left: .5em;" target="_blank">
                <span>Edit in StackBlitz</span>
            </a>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;h5&gt;Positions&lt;/h5&gt;
&lt;div class="grid p-fluid"&gt;
    &lt;div class="col-12 md:col-3"&gt;
        &lt;input type="text" pInputText pTooltip="Enter your username" placeholder="Right"&gt;
    &lt;/div&gt;
    &lt;div class="col-12 md:col-3"&gt;
        &lt;input type="text" pInputText pTooltip="Enter your username" tooltipPosition="top" placeholder="Top"&gt;
    &lt;/div&gt;
    &lt;div class="col-12 md:col-3"&gt;
        &lt;input type="text" pInputText pTooltip="Enter your username" tooltipPosition="bottom" placeholder="Bottom"&gt;
    &lt;/div&gt;
    &lt;div class="col-12 md:col-3"&gt;
        &lt;input type="text" pInputText pTooltip="Enter your username" tooltipPosition="left" placeholder="Left"&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;h5&gt;Focus and Blur&lt;/h5&gt;
&lt;input type="text" pInputText pTooltip="Enter your username" placeholder="Right" tooltipEvent="focus"&gt;

&lt;h5&gt;Button&lt;/h5&gt;
&lt;button pButton type="button" label="Save" icon="pi pi-check" pTooltip="Click to proceed"&gt;&lt;/button&gt;
</app-code>

        </p-tabPanel>
        <p-tabPanel header="StackBlitz">
            <ng-template pTemplate="content">
                <iframe src="https://stackblitz.com/edit/primeng-tooltip-demo?embed=1" style="width: 100%; height: 768px; border: none;"></iframe>
            </ng-template>
        </p-tabPanel>
     </p-tabView >
</div>
